package chixing.day12.generic;

public class PointTest {
    public static void main(String[] args) {
        Point<Integer> point1 = new Point<>();//菱形语法
        point1.setX(10);
        point1.setY(20);

        Point<Float> point2 = new Point<>();
        point2.setX(98.0f);
        point2.setY(100.7f);

        Point<Double> point4 = new Point<>();


        Point<String> point3 = new Point<>("33.25", "78.1");
        String x = point3.getX();
        String y = point3.getY();

        test1(point1);
        test2(point3);
//        test2(point2);//test2定义的泛型是Integer类型，只能传Integer类型的point
        test(point1);
        test(point2);
        test(point3);
    }

    public static void test1(Point<Integer> point){}
    public static void test2(Point<String> point){}
    //? t通配符，可以匹配任何类型
    public static void test(Point<?> point){}
}
